package com.zykj.observer.weather;

import com.zykj.observer.DisplayElement;
import com.zykj.observer.Observer;
import com.zykj.observer.Subject;

/**
 * @author zhoulj(周利军) [1217102780@qq.com]
 * @Title: CurrentConditionsDisplay
 * @Project: ${MODEL_NAME}
 * @Module ID:   <(模块)类编号，可以引用系统设计中的类编号>
 * @Comments: <对此类的描述，可以引用系统设计中的描述>
 * @JDK version used:      <JDK1.8> 50
 * @since 2018/12/26-11:50
 */
public class CurrentConditionsDisplay implements Observer, DisplayElement {
    float shudu; float wendu; float pressure;
    Subject weatherData;
    public CurrentConditionsDisplay(){}
    public CurrentConditionsDisplay(Subject weatherData) {
        this.weatherData = weatherData;
        weatherData.registerObserver(this);
    }
    @Override
    public void display() {
        System.out.println(String.format("目前统计布告栏得到通知， 通知消息：shudu:%s, wendu:%s, pressure:%s",shudu,wendu,pressure ));
    }

    @Override
    public void update(float shudu, float wendu, float pressure) {
        this.shudu=shudu;
        this.wendu=wendu;
        this.pressure=pressure;
        display();
    }
}
